/**
 * Created by Administrator on 2017/11/23.
 */
function Person(){
    var  age  = 30;
    this.age = 22;
    this.name = "zhangsan"
}
Person.prototype.headCount  = 1;
var p = new Person();
var p1 = new Person();
Person.prototype.headCount = 2;

typeof Person.prototype
//"object"
typeof Person.constructor
//"function"
    /* function Person(){
    var  age  = 30;
    this.age = 22;
    this.name = "zhangsan"
    }*/
p.constructor.prototype.headCount
// 2


//
    parent = {
        "name":"zhansan",
        "age":"12",
        school:{
            "address":"山东省菏泽市",
            "class":"4"
        }
    }
    child={
        language:"English"
    }
    //对象的深层拷贝
    function Objextends(parent,child){
        var child = child || {};
        for( var prop in parent){
            if(typeof(parent[prop]) =="object"){
                child[prop] = (parent[prop].constructor === "Array")?[]:{};
                Objextends(parent[prop],child[prop]);
            }else{
                child[prop] = parent[prop];
            }
        }
    }
    function Extends(p,c){
        var c = c || {};
        for(var prop in p){
            if(typeof (p[prop]) == "object"){  //判断是否为对象
                c = (p[prop].constructor === "Array") ? [] :{}; //判断对象的构造器是对象，还是数组
                 Extends(p[prop],c[prop]);  //递归调用
            }else{
                c[prop] = p[prop]; //不是对象直接复制
            }
        }
    }

function parents(){
        this.name = "12";
        this.age = "12";
        this.address={
            "phone":"13189188190",
        }
}
function childs(){
    this.sex = 123;
    parents.call(this); //对象的拷贝 等价于
}

